#ifndef _WMANAGER_H__
#define _WMANAGER_H__

#include <ncurses.h>

#define W_PROG  1
#define W_SOLVE 2

WINDOW *create_newwin(int height, int width, int starty, int startx);
void    destroy_win(WINDOW *local_win);


/** Abstract class for handling output to screen. */
class CWManager
{
 protected:
  static CWManager *instance;
  
 public:
  CWManager();
  ~CWManager();
  
  static CWManager *getInstance() { return instance; };
  
  /** Writes formated data to particular window. */
  virtual void log(int window, const char *s) = 0;
  
  /** Writes percentage of a process. */
  virtual void logPct(int window, int pct) = 0;
};


/** Class for handling windows by ncurses. */
class CNCursesWManager : public CWManager
{
 private:
  WINDOW *progW,  /** Window with main program information. */
         *solveW; /** Window with solution information. */
  int progWx, progWy, progWw, progWh,
      solveWx, solveWy, solveWw, solveWh; /**< Window dimensions. */
  
 public:
  CNCursesWManager();
  ~CNCursesWManager();
  
  void log(int window, const char *s);
  void logPct(int window, int pct);
};

class CPlainWManager : public CWManager
{
 public:
  void log(int window, const char *s);
  void logPct(int window, int pct);
};


#endif
